import { fileURLToPath, URL } from 'node:url'
import AutoImport from 'unplugin-auto-import/vite';
import Components from 'unplugin-vue-components/vite';
import { VantResolver } from '@vant/auto-import-resolver';
import { defineConfig } from 'vite'

// Lazyload 指令需要单独进行123注册
// https://vitejs.dev/config/
import vue from '@vitejs/plugin-vue';
// import vueJsx from '@vitejs/plugin-vue-jsx';




import { server } from 'typescript';

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [
    vue(),
    // vueJsx(),
      AutoImport({
      resolvers: [VantResolver()],
    }),
      Components({
      resolvers: [VantResolver()],
    }),
  ],
  resolve: {
    alias: {
      '@': fileURLToPath(new URL('./src', import.meta.url))
    }
  },
  server:{
    open:true,
  
    proxy:{

         '/api': {
        target: 'http://124.221.74.149:8011',
        changeOrigin: true,
        rewrite: (path) => path.replace(/^\/api/, ''),
      },
      '/v1':{
        target:'https://www.chunyuyisheng.com',
        changeOrigin:true,
        rewrite:path => path.replace(/^\/v1/,'')
      }
    }
  }
})
